import api from "./api_base";
import { CpuType } from "./type";

//获取CPU系列
export const getCpuSeries = (manufacturers: string) => {
  return api.get("/cpu/series", {
    params: {
      manufacturers,
    },
  });
};

// 获取 CPU列表
export const getCpuList = (manufacturers: string, series: string) => {
  return api.get("/cpu/code", {
    params: {
      manufacturers,
      series,
    },
  });
};

//上传CPU信息
export const uploadCpuInfo = (data: CpuType) => {
  return api.post("/cpu/cpuinfo", data);
};

//获取CPU信息
export const getCpuInfo = (page: number, limit: number, data: any) => {
  return api.get("/cpu/cpuinfo", {
    params: {
      page,
      limit,
      ...data,
    },
  });
};

//通过id更新CPU信息

export const updateCpuInfo = (id: string, data: CpuType) => {
  return api.post(`/cpu/cpuinfo/${id}`, data);
};

//通过id删除CPU信息
export const deleteCpuInfo = (id: string) => {
  return api.post(`/cpu/cpuinfo/delete/${id}`);
};
